<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <script type="text/javascript" src="../../inc/ctx.jsp"></script>
        <script type="text/javascript" src="../js/g.js"></script>
        <script type="text/javascript" src="http://cdn.uuola.cn/js/formvalid.js" charset="utf-8"></script>
        <script type="text/javascript" src="http://cdn.uuola.cn/js/jq.md5.js" charset="utf-8"></script>
        <link href="../css/com.css" type="text/css" rel="stylesheet"/>
        <style>
            #panel{width:90%;}
        </style>
    </head>
    <body>

        <div id="panel">
            <form id="mgr_reset_frm" name="mgr_reset_frm">
                <table>
                    <tr>
                        <th colspan="3">&nbsp;重置登录密码</th>
                    </tr>
                    <tr>
                        <td width="21%"  class="r">原始密码：</td>
                        <td width="30%"><label for="orgkey"></label>
                            <input type="password" name="orgkey" id="orgkey" tabindex="1" valid="required" errmsg="原始密码不能为空!" >
                            <input type="hidden" name="newkey" id="newkey" value="" />
                            *</td>
                        <td width="49%"><div id="err_orgkey"></div></td>
                    </tr>
                    <tr>
                        <td  class="r">重置密码：</td>
                        <td><input type="password" name="newkey1" id="newkey1" tabindex="2" valid="required" errmsg="重置密码不能为空!" >
                            *</td>
                        <td><div id="err_newkey1"></div></td>
                    </tr>
                    <tr>
                        <td  class="r">再次输入重置密码：</td>
                        <td><label for="newkey"></label>
                            <input type="password" name="newkey2" id="newkey2" tabindex="3" valid="required|eqaul" eqaulName="newkey1" errmsg="请再次确认重置密码!|两次重置密码不同!" >
                            *</td>
                        <td><div id="err_newkey2"></div></td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td align="center">&nbsp;
                            <input name="submitBtn" type="button" class="button medium orange" id="submitBtn" tabindex="7" value="修改" onClick="MST.submit();" /></td>
                        <td>&nbsp;(重置成功后会要求重新登录系统)</td>
                    </tr>
                </table>
            </form>
        </div>
        <script type="text/javascript">
            var frm = ut.e('mgr_reset_frm');
            initValid(frm);
            var MST={
                submit:function(){
                    var $rb=$('#submitBtn');
                    if(validator(frm)){
                        $rb.attr('disabled','disabled');
                        $('#orgkey').val($.md5($('#orgkey').val()));
                        $('#newkey').val($.md5($('#newkey1').val()));
                        $.get('../app/admin/reset_key.shtm',$('#mgr_reset_frm').serialize(),function(x){
                            var r = $.trim(x);
                            if(r=='ok'){
                                ut.m('修改密码成功!');
                                MGR.logout();
                            }else{
                                ut.m('修改密码错误.!'+r);
                                frm.reset();
                                $rb.removeAttr('disabled');
                            }
                        });
                    }   
                }
            };  
        </script>
    </body>
</html>
